package com.qf.springbootexam.config;






import io.swagger.annotations.Api;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import javax.validation.groups.ConvertGroup;
@EnableSwagger2
@Configuration
public class SwaggerConfig {

    @Bean
    public Docket buildDocket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(getApiInfo()).select().apis(RequestHandlerSelectors.basePackage("com.qf.springbootexam.controller")).build();

    }

    private ApiInfo getApiInfo() {
        return new ApiInfoBuilder().contact(new Contact("千锋教育","http://www.baidu.com","wenhualiu340@gmail.com"))
                .title("swagger项目")
                .version("0.0.1")
                .description("由swagger生成的项目接口文件")
                .build();
    }
}

